main(List<String> args) {
// 1.通过类声明变量不需要new关键字
  final p1 = Person('zhangsan');
  print(p1);
  final p2 = Person('zhangsan');
  // identical 对比是否为同一个对象
  print(identical(p1, p2));

// 2.const声明类似于单例模式的类
  const c1 = Car('xiaomi');
  const c2 = Car('xiaomi');
  const c3 = Car('geek');
  // final c1 = Car('xiaomi');
  // final c2 = Car('xiaomi');
  // final c3 = Car('geek');
  print(identical(c1, c2));
  print(identical(c1, c3));
}

class Person {
  String? name;
  Person(String name) {
    this.name = name;
  }
}

class Car {
  final String name;
  const Car(this.name);
}
